/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.system.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author 王宇
* @date 2023-10-07
**/
@Entity
@Data
@Table(name="identity_order")
public class IdentityOrder implements Serializable {

    @Id
    @Column(name = "order_id")
    @ApiModelProperty(value = "主键")
    private Long orderId;

    @Column(name = "order_no")
    @ApiModelProperty(value = "订单编号")
    private String orderNo;

    @Column(name = "open_id")
    @ApiModelProperty(value = "openid")
    private String openId;

    @Column(name = "pre_payid")
    @ApiModelProperty(value = "预支付流水号")
    private String prePayid;

    @Column(name = "pay_serialid")
    @ApiModelProperty(value = "支付流水号")
    private String paySerialid;

    @Column(name = "pay_amount")
    @ApiModelProperty(value = "支付金额")
    private BigDecimal payAmount;

    @Column(name = "identity_amount")
    @ApiModelProperty(value = "身份金额")
    private BigDecimal identityAmount;

    @Column(name = "discount_amount")
    @ApiModelProperty(value = "优惠金额")
    private BigDecimal discountAmount;

    @Column(name = "pay_status")
    @ApiModelProperty(value = "支付状态，0：未支付，1：已支付")
    private Integer payStatus;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "expire_time")
    @ApiModelProperty(value = "超时取消时间")
    private Timestamp expireTime;

    @Column(name = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "order_type")
    @ApiModelProperty(value = "类型")
    private Integer orderType;

    @Column(name = "biz_id")
    @ApiModelProperty(value = "业务ID")
    private String bizId;

    @Column(name = "order_status")
    @ApiModelProperty(value = "订单状态")
    private Integer orderStatus;

    public void copy(IdentityOrder source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}